const Controller = require('../../core/controller/ApiController');
const {Route, HttpGet, HttpPost, Middleware, filters} = require('../../../plugin/egg-decorator-router/lib');
const {ExceptionHandler} = require('../../../plugin/egg-controller-exception-handler/lib');

@Route('/api/mobile/user')
class UserCtrl extends Controller {

    //移动端登录

    //家长登录
    @HttpPost('/parentLogin')
    @ExceptionHandler()
    async parentLogin() {
        const rule = {
            child_number:'string',
            parent_phonr:'string'
        };
        this.validate(rule,this.ctx.request.body);
        this.result.data = await this.service.mobile.user.main.parentLogin(this.ctx.request.body);
        return '登录成功'
    }

    //学生端登录
    @HttpPost('/studentLogin')
    @ExceptionHandler()
    async studentLogin() {
        const rule = {
            user_number:'string',
            password:'string'
        };
        this.validate(rule,this.ctx.request.body);
        this.result.data = await this.service.mobile.user.main.studentLogin(this.ctx.request.body);
        return '登录成功'
    }


}


module.exports = UserCtrl;
